<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /* 
            数组的添加-删除-修改操作.html
            push() 方法将一个或多个元素添加到数组的末尾，并返回该数组的新长度。
            pop() 方法从数组中删除最后一个元素，并返回该元素的值。此方法会更改数组的长度。
            shift() 方法从数组中删除第一个元素，并返回该元素的值。此方法更改数组的长度。
            unshift() 方法将一个或多个元素添加到数组的开头，并返回该数组的新长度。
        */
        /* const animals = ["pigs", "goats", "sheep"];

            const count = animals.push("cows");
            console.log(count);
            // Expected output: 4
            console.log(animals);
            // Expected output: Array ["pigs", "goats", "sheep", "cows"]

            animals.push("chickens", "cats", "dogs");
            console.log(animals);
            // Expected output: Array ["pigs", "goats", "sheep", "cows", "chickens", "cats", "dogs"] */

            /* const plants = ["broccoli", "cauliflower", "cabbage", "kale", "tomato"];

                console.log(plants.pop());
                // Expected output: "tomato"

                console.log(plants);
                // Expected output: Array ["broccoli", "cauliflower", "cabbage", "kale"]

                plants.pop();

                console.log(plants);
                // Expected output: Array ["broccoli", "cauliflower", "cabbage" */
            
            // var array1 = [1, 2, 3];
                // var firstElement = array1.shift();
                // console.log(array1);
                // expected output: Array [2, 3]
                // console.log(firstElement);
                // expected output: 1

                // var array1 = [1, 2, 3];
                // console.log(array1.unshift(4, 5));
                // // expected output: 5
                // console.log(array1);
                // expected output: Array [4, 5, 1, 2, 3]
    </script>
</head>
<body>
    
</body>
</html>